MPCreateSemaphore

Creates a semaphore.

OSStatus MPCreateSemaphore (
                     MPSemaphoreCount maximumValue,
                     MPSemaphoreCount initialValue,
                     MPSemaphoreID *semaphore);
maximumValue
A value of type MPSemaphoreCount that specifies the maximum allowed value of the semaphore.

initialValue
A value of type MPSemaphoreCount that specifies the initial value of the semaphore.

semaphore
A pointer to a variable of type MPSemaphoreID . On return, the variable contains the ID of the newly-created semaphore.

function result
A result code. See Result Codes for a list of possible values.
DISCUSSION
If you want to create a binary semaphore, you can call the macro MPCreateBinarySemaphore (MPSemaphoreID *semaphore) instead, which simply calls MPCreateSemaphore with both maximumValue and initialValue set to 1.

VERSION NOTES
Introduced with Multiprocessing Services 1.0.

SEE ALSO
The function MPDeleteSemaphore .


© 1999 Apple Computer, Inc. – (Last Updated 17 Nov 99)